import java.util.Scanner;

public class CountNumber {
    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        while(s.hasNext()) {
            String str = s.nextLine();
            String[] strs = str.split(" ");
            char[] c1 = strs[0].toCharArray();
            char[] c2 = strs[1].toCharArray();
            int len1 = Integer.parseInt(strs[2]);
            int len2 = Integer.parseInt(strs[3]);
            int[] dp = new int[len2 + 1];
            int nums = 0;
            for(int i = 1; i <= len2; i++) {
                dp[i] = (dp[i - 1] * 26) % 1000007;
                if(i <= c1.length) dp[i] = dp[i] - (c1[i - 1] - 96);
                if(i <= c2.length) dp[i] = dp[i] + (c2[i - 1] - 96);
                if(i >= len1) nums += dp[i];
            }
            System.out.println((nums - 1) % 1000007);
        }
    }
}
